<?php
$xtpl = new XTemplate("modules/home/static_page_task.htm");
//--
$UPLOAD = new UPLOAD();
//--
$POST = $_POST;

if($_POST[type] == 'NEW'){	
	$POST['sp_code'] =$POST['code'];
	$POST['sp_name']=($POST['name']);
        $POST['sp_name']=($POST['name']);
	$POST['sp_short_description']= ($POST['shortdes']);
        $POST['id_lang']= $_SESSION['ID_LANG_ADM'];
	//--
	$DB->DBInsert('static_pages', $POST);
	//--
	$GUI->redir("?mod=home&act=static_page");
}
elseif($_POST[type] == 'EDIT'){
	$POST['sp_code']	=$POST['code'];
	$POST['sp_name']	=$POST['name'];
        $POST['sp_short_description']= ($POST['shortdes']);
	$POST['sp_text']= ($POST['description']);

	//--
	$DB->DBUpdate('static_pages', $POST, "WHERE sp_id = '".$POST['id']."'");
	//--
	$GUI->redir("?mod=home&act=static_page");
}
//--
//--
if($_GET[id] != ''){
	$row = $DB->FetchData('static_pages','*',"WHERE sp_id='".$_GET[id]."'");
	$row['type'] = 'EDIT';
	$row['code']=stripslashes($row['sp_code']);
	$row['id']=$row['sp_id'];
	$row['name'] = stripslashes($row['sp_name']);
        $row['shortdes']=stripslashes($row['sp_short_description']);
	
}else{
	$row[type] = 'NEW';
}
//--
//--
$_FCKeditor = new FCKeditor("description");
$_FCKeditor->BasePath = $siteFCKeditorPath;
$_FCKeditor->Width = '95%';
$_FCKeditor->Height = '450';
$_FCKeditor->Value = stripslashes($row['sp_text']);

$xtpl->assign("write",$row);
//--
//--
$waypathlink = '&raquo;&nbsp;<a href="?mod=home&act=supplier" class="waypath">Static Page Management</a>:&nbsp;'.$row[type];
$xtpl_main->assign("waypathlink",$waypathlink);
//--
//--
$save_button = $GUI->button_ren("Save","javascript: doSavenews();");
$xtpl->assign("save_button",$save_button);
//--
$cancel_button = $GUI->button_ren("Cancel","javascript: add('?mod=home&act=static_page');");
$xtpl->assign("cancel_button",$cancel_button);

?>